package router

import (
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/customer"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/frontsetting"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/handler/dictionary"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/monitor"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/business/workorder"
	"gitee.com/baal1990/gitee.com/baal1990/cmd/server/app/middleware"
	"github.com/gin-gonic/gin"
)

func Router2User(r *gin.Engine) {
	routeFront := r.Group("/frontend")
	{
		routeFront.POST("/customer-sms-login", customer.LoginSmsCustomer) //用户短信验证码登录
		routeFront.POST("/customer-login", customer.LoginCustomer)        //用户登录
		routeFront.POST("/insert-customer", customer.AddNewCustomer)      //添加注册新用户
		routeFront.Use(middleware.TokenCheckCustomer())
		{
			dict := routeFront.Group("/dict-client")
			dict.Use(middleware.TokenCheckCustomer())
			{
				dict.GET("/getdictlist", dictionary.GetDictInfo)
				dict.GET("/getdictdetailbyname", dictionary.GetDictDetailByName)
			}
			//前端设置模块
			routeFront.GET("/registrationprotocol", frontsetting.QueryRegistrationProtocol) //查询注册协议
			routeFront.GET("/platformnotice", frontsetting.QueryPlatformNotice)             //查询平台须知
			routeFront.GET("/messagenotice", frontsetting.QueryMessageNotice)               //查询留言须知
			routeFront.GET("/friendshiplinks", frontsetting.QueryFriendshipLinks)           //查询子公司链接/友情链接 列表

			routeFront.GET("/certificatetypes", customer.QueryAllCertificateTypes) //证件类型 列表
			routeFront.GET("/customertypes", customer.QueryAllCustomerTypes)       //客户类型 列表

			// 客户接口
			routeFront.GET("/customercertificatetypes", customer.QueryAllCertificateTypes)                    //查询所有证件类型
			routeFront.GET("/query-customer", customer.QueryAllCustomers)                                     //查询用户列表（分页）
			routeFront.GET("/query-customer-detail", customer.QueryCustomerDetail)                            //查询用户详情
			routeFront.POST("/update-customer", customer.UpdateCustomer)                                      //更新用户信息
			routeFront.POST("/customer-logout", customer.LogoutCustomer)                                      //用户登出
			routeFront.DELETE("/delete-customer", customer.DeleteCustomer)                                    //用户删除
			routeFront.POST("/customer-bind-mobile-check", customer.BindMobileToCustomerCheck)                //绑定手机号到用户-校验密码
			routeFront.POST("/customer-bind-mobile", customer.BindMobileToCustomer)                           //绑定手机号到用户
			routeFront.POST("/customer-banding-email", customer.BandingEmailToCustomer)                       //绑定邮箱到用户
			routeFront.POST("/customer-change-password", customer.CustomerChangePassword)                     //用户修改密码
			routeFront.POST("/customer-retrieve-pwd-msgvercode", customer.RetrieveCustomerPasswordMsgVerCode) //用户找回密码（使用手机）,向手机号发送短信验证码，返回用户id（密文）

			//工单接口
			routeFront.GET("/opiniontypes", workorder.QueryOpinionTypes)             //查询意见类型
			routeFront.POST("/commit-opinion", workorder.AddWorkerOrder)             //用户提交留言
			routeFront.GET("/query-my-opinion", workorder.QueryCustomerWorkerOrders) //查询用户所提交的所有留言
		}
	}
	monitor.TimingMonitorStart()
}
